bugfix(cli): prevent a user from adding a duplicate IP (#3056)#3139
Merged
bgm-malbeclabs merged 4 commits intomainfrom Feb 27, 2026
Merged
bugfix(cli): prevent a user from adding a duplicate IP (#3056)#3139bgm-malbeclabs merged 4 commits intomainfrom
bgm-malbeclabs merged 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a CLI-side safeguard to prevent assigning the same IPv4 network to multiple interfaces owned by the same contributor, addressing accidental duplicate on-chain interface IP assignments (Issue #3056).
Changes:
- Add duplicate
ip_netdetection across all devices belonging to the samecontributor_pkduringdevice interface create. - Add the same duplicate
ip_netdetection duringdevice interface update, while attempting to skip the interface being updated. - Update unit tests to cover duplicate-IP failures for both create and update, and document the change in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
smartcontract/cli/src/device/interface/update.rs |
Parses --ip-net, checks for duplicates across contributor devices before issuing the update, and adds tests for duplicate-IP rejection. |
smartcontract/cli/src/device/interface/create.rs |
Checks for duplicates across contributor devices before creating an interface, and adds a test for duplicate-IP rejection. |
CHANGELOG.md |
Notes the new CLI duplicate-IP prevention behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
elitegreg
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR adds an IP duplicate check at the CLI (but not on the smart contract) to prevent a user from accidentally adding a duplicate IP. Devices are fetched, then filtered to the user's devices, and then the check is peformed on both create and update. If there is a duplicate detected, an error is returned.
Closes #3056
Testing Verification